package com.lap.auth.application.api.command;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
@Schema(description = "更新Api命令")
public class CreateApiCmd {

  @NotEmpty(message = "{api.module.required}")
  @Length(max = 30, message = "{api.module.max.length}")
  @Schema(description = "接口模块")
  private String module;

  @Length(max = 250, message = "{api.parentCode.max.length}")
  @Schema(description = "接口父编码")
  private String parentCode;

  @NotEmpty(message = "{api.code.required}")
  @Length(max = 250, message = "{api.code.max.length}")
  @Schema(description = "接口编码")
  private String code;

  @Length(max = 60, message = "{api.name.max.length}")
  @Schema(description = "接口名称")
  private String name;

  @Schema(description = "接口方法")
  @Length(max = 16, message = "{api.method.max.length}")
  private String method;

  @Length(max = 256, message = "{api.uri.max.length}")
  @Schema(description = "URI")
  private String uri;

  @NotNull(message = "{api.apiType.required}")
  @Range(min = 0, max = Integer.MAX_VALUE, message = "{api.apiType.range}")
  @Schema(description = "接口类型")
  private Integer apiType;

  @NotNull(message = "{api.viewType.required}")
  @Range(min = 0, max = Integer.MAX_VALUE, message = "{api.viewType.range}")
  @Schema(description = "访问类型")
  private Integer viewType;

  @NotNull(message = "{api.accessLevel.required}")
  @Range(min = 0, max = Integer.MAX_VALUE, message = "{api.accessLevel.range}")
  @Schema(description = "接口访问级别")
  private Integer accessLevel;
}
